package com.UnionPayCenter.mapper;

import com.UnionPayCenter.base.MyMapper;
import com.UnionPayCenter.entity.UserEntity;
import com.UnionPayCenter.entity.vo.UserVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface UserMapper extends MyMapper<UserEntity> {

    List<UserEntity> selectByIds(@Param("userIds") List<Integer> userIds);

    /**
     * 查询店铺下的有效用户
     *
     * @param shopId 店铺Id
     * @return 用户信息
     */
    List<UserEntity> selectByShopId(@Param("shopId") Integer shopId);

    UserVo selectByOpenid(@Param("shopId") Integer shopId, @Param("openid") String openid);

    List<UserVo> selectUserList(@Param("shopId") Integer shopId, @Param("mobile") String mobile);

    int insertBatch(@Param("userList") List<UserEntity> userList);

    UserVo selectByMobile(@Param("shopId") Integer shopId, @Param("mobile") String mobile);

    UserVo selectInfo(@Param("userId") Integer userId);

    List<UserVo> selectList(@Param("shopId") Integer shopId, @Param("mobile") String mobile, @Param("startTime") String startTime,
                            @Param("endTime") String endTime, @Param("userLevel") Integer userLevel,
                            @Param("startAmount") Integer startAmount, @Param("endAmount") Integer endAmount,
                            @Param("startTotalAmount") Integer startTotalAmount, @Param("endTotalAmount") Integer endTotalAmount);

    int saveCardNumber(@Param("userEntity") UserVo userEntity);

    UserVo findByWxCard(@Param("wxCard") String wxCard);

    int updateUnionid(@Param("userEntity") UserEntity userEntity);

    UserVo getByUnionid(@Param("unionid") String unionid, @Param("shopId") Integer shopId);

    int updateByOpenid(@Param("userEntity") UserEntity user);
}
